<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Just Another CodeIgniter Extension (JACE)</title>

<style type='text/css' media='all'>@import url('./css/userguide.css');</style>
<link rel='stylesheet' type='text/css' media='all' href='css/userguide.css' />
<script type="text/javascript" src="js/nav.js"></script>
<script type="text/javascript" src="js/prototype.lite.js"></script>
<script type="text/javascript" src="js/moo.fx.js"></script>

<script type="text/javascript" src="js/user_guide_menu.js"></script>

<meta http-equiv='expires' content='-1' />
<meta http-equiv= 'pragma' content='no-cache' />
<meta name='robots' content='all' />

</head>

<body>

<!-- START NAVIGATION -->
<div id="nav">
	<div id="nav_inner">

		<table cellpadding="0" cellspaceing="0" border="0" style="width: 98%">
			<tr>
				<td class="td" valign="top">
					<ul>
						<li><a href="index.html">User Guide Home</a></li>
					</ul>

					<h3>Introduction</h3>
					<ul>
						<li><a href="index.html">Basic Concepts</a></li>
						<li><a href="getting_started.html">Getting Started</a></li>
						<li><a href="features.html">Supported Features</a></li>
					</ul>
					
					<h3>Installation</h3>
					<ul>
						<li><a href="downloads.html">Downloading JACE</a></li>
						<li><a href="requirements.html">Server Requirements</a></li>						
						<li><a href="installation.html">Installation Instructions</a></li>
						<li><a href="troubleshooting.html">Troubleshooting</a></li>
					</ul>
		
				</td>
				<td class="td_sep" valign="top">
					<h3>Extended Core Class Reference</h3>
					<ul>
						<li><a href="MY_Loader.html">Loader Class</a></li>
						<li><a href="MY_Output.html">Output Class</a></li>
					</ul>
								
					<h3>Predefined Controllers</h3>
					<ul>
						<li><a href="js.html">Js Controller</a></li>
						<li><a href="css.html">Css Controller</a></li>
						<li><a href="media.html">Media Controller</a></li>
					</ul>
				</td>
				<td class="td_sep" valign="top">

					<h3>Hooks Reference</h3>
					<ul>
						<li><a href="cache_path_hook.html">Change Cache Path Hook</a></li>
					</ul>

					<h3>Helper Reference</h3>
					<ul>
						<li><a href="output_helper.html">Output Helper</a></li>
					</ul>
					
					<h3>Basic Info</h3>
					<ul>

						<li><a href="license.html">License Agreement</a></li>
						<li><a href="changelog.html">Change Log</a></li>
						<li><a href="credits.html">Credits</a></li>
					</ul>				

				</td>
			</tr>
		</table>

	</div>
</div>
<div id="nav2"><a name="top"></a><a href="javascript:void(0);" onclick="myHeight.toggle();"><img src="images/nav_toggle_darker.jpg" width="154" height="43" border="0" title="Toggle Table of Contents" alt="Toggle Table of Contents" /></a></div>
<div id="masthead">
<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
<tr>
<td><h1>Just Another CodeIgniter Extension (JACE) - Loader Class</h1></td>
<td id="breadcrumb_right"><a href="#">Home</a> &raquo; Loader Class</td>
</tr>
</table>
</div>
<!-- END NAVIGATION -->

<!-- START BREADCRUMB -->
<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
<tr>
<td id="breadcrumb">
<a href="http://code-junkie.net/jace">Project Home</a> &nbsp;&#8250;&nbsp;
<a href="index.html">User Guide Home</a> &nbsp;&#8250;&nbsp; Loader Class
</td>
<td id="searchbox"><form method="get" action="http://www.google.com/search"><input type="hidden" name="as_sitesearch" id="as_sitesearch" value="example.com/user_guide/" />Search Project User Guide&nbsp; <input type="text" class="input" style="width:200px;" name="q" id="q" size="31" maxlength="255" value="" />&nbsp;<input type="submit" class="submit" name="sa" value="Go" /></form></td>
</tr>

</table>
<!-- END BREADCRUMB -->

<br clear="all" />


<!-- START CONTENT -->
<div id="content">


<h1>Loader Class</h1>

<p>
	This is an extension of the loader class. The file must be inside your application/core folder and should be named {subclass_prefix}Loader.php,
	by default the subclass_prefix is MY_ but this can be changed from the CI config file.
</p>

<p class="important"><strong>Important:</strong>&nbsp; This class needs <kbd>MY_Output</kbd> to be present.</p>

<p>Features:</p>

<ul>
	<li>Templates</li>
	<li>Template Sections</li>
	<li>Load Css Files</li>
	<li>Load Javascript Files</li>
	<li>Add Javascript code from views</li>
	<li>Load views from other paths than the appclication/views directory.</li>
</ul>

<h2>Inline scripting Functions Reference</h2>
<p>
	By the term <kbd>"Inline scripting"</kbd> I mean the javascript that  you may have in a view file.<br />
	This function provides you the ability to write javascript code in view files but in the final output this
	javascript code will be passed in a file or in a specific <kbd>&lt;script&gt;</kbd> element in the template, 
	with all gathered javascript code from all loaded view files in a presentation.
</p>

<p class="important"><strong>IMPORTANT: </strong> This functionality to work properly it needs the presence of the <kbd>Js Controller (APPPATH/controllers/content/js.php)</kbd>.</p>

<h3>$this->load->start_inline_scripting()</h3>

<h3>$this->load->end_inline_scripting([$strip_tags=true[, $append_to_file=true]])</h3>

<code>
&lt;?php
//This code is inside a view file<br />
$this->load->start_inline_scripting(); ?&gt;<br /><br />

&lt;script type="text/javascript"&gt;<br />
//some javascript code in here
....<br />
&lt;/script&gt;<br /><br />
&lt;?php $this->load->end_inline_scripting(); 
<br />
<br />
$this->load->start_inline_scripting(); ?&gt;<br /><br />

&lt;script type="text/javascript"&gt;<br />
//some javascript code in here
....<br />
&lt;/script&gt;<br /><br />
&lt;?php <br />
//This will append the script above in an script element inside the template<br/>
//with the the script element of the example stripped.<br/>
$this->load->end_inline_scripting(<var>true</var>, <var>false</var>);
<br />
<br />
$this->load->start_inline_scripting(); ?&gt;<br /><br />

&lt;script type="text/vbscript"&gt;<br />
//some code in here
....<br />
&lt;/script&gt;<br /><br />
&lt;?php<br /> 
//This will append the above code in the template as it is, without stripping the script element<br />
$this->load->end_inline_scripting(<var>false</var>, <var>false</var>); ?&gt;

</code>
<p class="important"><strong>NOTE: </strong> Inside a view file <kbd>$this</kbd> refers at the current instance of the 
MY_Loader class, so the <kbd>->load</kbd> part can be missing at any  MY_Loader or Loader class method call.</p>

<h2>css() Method Reference</h2>

<h3>MY_Loader $this-&gt;load-&gt;css($css_file1[, $css_file2,...[,$css_fileN]])</h3>
<p>
	This method will append the &lt;link&gt; elements with the specified css files. It can be local files or external files.
	For local css files the method will also check if the file exists and if not it will display an error.<br />
	The method will also check if a css file has been declared already, by using the css method, so the css file won't be appended again.
</p>

<code>
	$this->load->css('public/css/foo.styles.css')<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;->css('public/css/foo.styles2.css', 'public/css/foo.styles3.css')<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;->css('http://www.example.org/styles/foo.css');
</code>

<h2>js() Method Reference</h2>

<h3>MY_Loader $this-&gt;load-&gt;js($js_file1[, $js_file2,...[,$js_fileN]])</h3>
<p>
	This method will append the &lt;script&gt; elements with the specified javascript files. It can be local files or external files.
	For local javascript files the method will also check if the file exists and if not it will display an error.<br />
	The method will also check if a javascript file has been declared already, by using the js method, so the 
	javascript file won't be appended again.
</p>

<code>
	$this->load->js('public/js/foo.js')<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;->css('public/js/foo2.js', 'public/css/foo3.js')<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;->css('http://www.example.org/js/foo.js');
</code>

<h2>section() Method Reference</h2>

<h3>string $this->load->section($area, $view[, $data=array()])</h3>
<p>
	This method loads the given view file in the pre-defined area(s) in the template.
	
</p>
<code>
	$data = array(<br />
		&nbsp;&nbsp;&nbsp;<var>'var1'=>'foo'</var>, <br />
		&nbsp;&nbsp;&nbsp;<var>'var2'=>'bar'</var><br />
		&nbsp;&nbsp;&nbsp;...<br />
		&nbsp;&nbsp;&nbsp;<var>'varN'=>'foobar'</var><br />
	);'
	<br />
	$this->load->section('<var>foo_section</var>', '<var>sections/left/foo</var>', $data);<br />
	$this->load->section('<var>foo_section</var>', '<var>sections/left/bar</var>', $data);<br />
	$this->load->section('<var>bar_section</var>', '<var>sections/right/foo</var>', $data);<br />
	$this->load->section('<var>bar_section</var>', '<var>sections/right/bar</var>', $data);<br />
</code>
<p class="important"><strong>NOTE:</strong> It can load more than one view in each area, by the given order of course.</p>
</div>
<!-- END CONTENT -->


<div id="footer">
<p><a href="http://code-junkie.net">Code-Junkie.net</a></p>
</div>

</body>
</html>